<%@page import="com.sun.javafx.collections.SetAdapterChange"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.cys.bean.User,com.cys.dao.UserDao;"%>
<%
	request.setCharacterEncoding("UTF-8");
	String account = request.getParameter("account");
	String passwd = request.getParameter("passwd");
	String name = request.getParameter("name");
	String address = request.getParameter("address");
	String mobile = request.getParameter("mobile");
	String resault = "";

	User user = new User();
	boolean nameRes = UserDao.getInstance().checkUserAccount(account);//判断用户名是否存在
	if (!nameRes) {//如果用户名不存在
		user.setAccount(account);
		user.setPasswd(passwd);
		user.setName(name);
		user.setMobile(mobile);
		user.setAddress(address);

		boolean res = UserDao.getInstance().saveUser(user);//注册信息保存数据库
		if (res) {
			request.getRequestDispatcher("Register.jsp").forward(request, response);
			//tell="";
			//formbean.getErrors().put("userName", "注册用户已存在！！");
			//   request.setAttribute("formbean", formbean);

		} else {
			request.getRequestDispatcher("Register.jsp").forward(request, response);
		}
	} else {
		request.getRequestDispatcher("error.jsp").forward(request, response);
	}
%>
